package SocketTool;

import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.Socket;
import java.net.UnknownHostException;


public class FileClient {
public static void main(String[] args) {
	try {
		Socket s=new Socket("192.168.1.129",6355);
		File file=new File("e:\\a\\a.txt");
		InputStream input=new FileInputStream(file);
		OutputStream out=s.getOutputStream();
		String str="";
		int len=0;
		byte[]buffer=new byte[1000];
		while ((len=input.read(buffer))!=-1) {
			out.write(buffer,0,len);	
		}
		System.out.println("传输结束....");
		s.close();
		out.close();
	} catch (UnknownHostException e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
	} catch (IOException e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
	}
}
}
